import {request} from 'umi';
import {IAddUserParams,IAddIdentity,IViewAuthority,IAuthorityApi,ISetIdentityApi,ISetIdentityView} from '@/interface/consumer';
//获取身份id
export const getUserIdentity = () => {
    return request('/user/identity',{method:'get'})
}

//获取api接口权限数据
export const getApiAuthority = () => {
    return request('/user/api_authority',{method:'get'})
}

//获取视图权限数据
export const getViewAuthority = () => {
    return request('/user/view_authority',{method:'get'})
}

//添加用户
export const addUser = (data:IAddUserParams) => {
    return request('/user',{method:'post',data})
}

//添加身份
export const addIdentity = (data:IAddIdentity) => {
    return request('/user/identity/edit',{method:'post',data})
}

//添加api接口权限
export const addAuthorityApi = (data:IAuthorityApi) => {
    return request('/user/authorityApi/edit',{method:'post',data})
}

//添加视图接口权限
export const addAuthorityView = (data:IViewAuthority) => {
    return request('/user/authorityView/edit',{method:'post',data})
}

//给身份设定api接口权限
export const setIdentityApi = (data:ISetIdentityApi) => {
    return request('/user/setIdentityApi',{method:'post',data})
}

//给身份设置视图权限
export const setIdentityView = (data:ISetIdentityView) => {
    return request('/user/setIdentityView',{method:'post',data})
}